<?php

class FormImageButton extends FormControl {
	
	public static $property = array(
		'wbtype',
		'name',
		'caption',
		'x',
		'y',
		'width',
		'height',
		'disabled',
		'tranparent',
		'autorepeat',
		'visible'
	);	
	
	public function __construct() { 
		parent::__construct(array(
			'wbtype' => 'ImageButton',
			'x' => 0,
			'y' => 0,
			'width' => 64,
			'height' => 64
		));
	}

	/**
	 * 컨트롤 그리기 
	 * 
	 * @param WBGraphics $graphics
	 */
	public function displayControl(WBGraphics $g) {
		
		$xstart = $this['x'];
		$ystart = $this['y'];
		$width = $this['width'];
		$height = $this['height'];
		
		for ($y = 0; $y < $height; $y += 32) { 
			for ($x = 0; $x < $width; $x += 32) { 
				$g->image(self::$imagebutton, $xstart + $x, $ystart + $y, min(32, $width - $x), min(32, $height - $y));
			}
		}
	}
	
	
	public function getProperty() { 
		return self::$property;
	}	
}


?>